<?php echo $this->fetch('header.html'); ?> 
<script type="text/javascript" src="<?php echo $this->lib_base . "/" . 'mobile/cart.js'; ?>" charset="utf-8"></script>
<script type="text/javascript">
$(function(){
	var id = $('input:radio:checked').attr('id');
	$('#selected-store strong').html($('#cart'+id+'_amount').html());
	$('input:radio').change(function(){
		var id2 = $(this).attr('id');
		$('#selected-store strong').html($('#cart'+id2+'_amount').html());
	})
	$('.cart-it .myscb').click(function(){
		$('.cart-it .myscb .masker').removeClass('active');
		$(this).find('.masker').addClass('active');
	})
})
function go2order()
{
	var store_id = $('input:radio:checked').val();
	window.location.href='<?php echo $this->_var['real_site_url']; ?>/index.php?app=order&goods=cart&store_id='+store_id;
}
</script>
<div id="main">
  <div id="page-cart" class="page-cart page-body">
  <?php $_from = $this->_var['carts']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('store_id', 'cart');$this->_foreach['fe_carts'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['fe_carts']['total'] > 0):
    foreach ($_from AS $this->_var['store_id'] => $this->_var['cart']):
        $this->_foreach['fe_carts']['iteration']++;
?>
  <div class="cart-it mt10 cart-it-<?php echo $this->_var['store_id']; ?>">
    <div class="store-info clearfix ">
      <div class="myscb relative">
      	<label for="<?php echo $this->_var['store_id']; ?>" class="masker absolute <?php if (($this->_foreach['fe_carts']['iteration'] <= 1)): ?>active<?php endif; ?>"></label>
        <input class="rebuild-checkbox"  name="store_id" type="radio"  id="<?php echo $this->_var['store_id']; ?>" <?php if (($this->_foreach['fe_carts']['iteration'] <= 1)): ?>checked="checked"<?php endif; ?> value="<?php echo $this->_var['store_id']; ?>"/>
      </div>
      <div class="info">
          <h3><span><label for="<?php echo $this->_var['store_id']; ?>"><?php echo htmlspecialchars($this->_var['cart']['store_name']); ?></label></span><span class="ml20 hidden">商品总价:&nbsp;&nbsp;<strong  id="cart<?php echo $this->_var['store_id']; ?>_amount"><?php echo price_format($this->_var['cart']['amount']); ?></strong></span></h3>      
      </div>
    </div>
    <ul>
      <?php $_from = $this->_var['cart']['goods']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'goods');$this->_foreach['fe_goods'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['fe_goods']['total'] > 0):
    foreach ($_from AS $this->_var['goods']):
        $this->_foreach['fe_goods']['iteration']++;
?>
      <li id="cart_item_<?php echo $this->_var['goods']['rec_id']; ?>">
        <div class="it clearfix webkit-box"> <a  href="<?php echo url('app=goods&id=' . $this->_var['goods']['goods_id']. ''); ?>" class="pic"><img src="<?php echo $this->_var['goods']['goods_image']; ?>" alt="<?php echo htmlspecialchars($this->_var['goods']['goods_name']); ?>" /></a>
          <div class="detail"> <a href="<?php echo url('app=goods&id=' . $this->_var['goods']['goods_id']. ''); ?>" class="desc">
            <h4><?php echo htmlspecialchars($this->_var['goods']['goods_name']); ?></h4>
            </a>
            <p class="props"><?php echo htmlspecialchars($this->_var['goods']['specification']); ?></p>
            <div class="price"> <span>￥</span> <em><?php echo $this->_var['goods']['price']; ?></em> x <span class="txt">
              <input type="text" value="<?php echo $this->_var['goods']['quantity']; ?>"   orig="<?php echo $this->_var['goods']['quantity']; ?>" changed="<?php echo $this->_var['goods']['quantity']; ?>" onkeyup="change_quantity(<?php echo $this->_var['store_id']; ?>, <?php echo $this->_var['goods']['rec_id']; ?>, <?php echo $this->_var['goods']['spec_id']; ?>, this);"/>
              </span> </div>
            <a class="del" href="javascript:;" onclick="drop_cart_item(<?php echo $this->_var['store_id']; ?>, <?php echo $this->_var['goods']['rec_id']; ?>);">删除</a> 
          </div>
        </div>
      </li>
      <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
    </ul>
  </div>
  <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
  <div class="go2order clearfix"><span class="float-left ml10" id="selected-store">商品总价：<strong><?php echo price_format($this->_var['cart']['amount']); ?></strong></span> <a  href="javascript:;"  onclick="go2order();"  class="btn float-right">去结算</a> </div>
  </div>
</div>